import java.util.ArrayList;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: dings
 * Date: 2024-06-27
 * Time: 18:59
 */
public class Test {
    public static void main(String[] args) {
        ArrayList<Phone> list = new ArrayList<>();

        list.add(new Phone("iPhone",8999));
        list.add(new Phone("vivo",4999));
        list.add(new Phone("HuaWei",3999));

        int lowPrice =  5000;
        ArrayList<Phone> list1 = findPhone(list,lowPrice);
        System.out.println(list1);
    }

    public static ArrayList<Phone> findPhone(ArrayList<Phone> list,int lowPrice) {
        ArrayList<Phone> list1 = new ArrayList<>();

        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getPrice() < lowPrice) {
                list1.add(list.get(i));
            }
        }

        return list1;
    }
    public static void main1(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();

        list.add(1);
        list.add(2);//ctr+D 向下复制一行
        list.add(3);
    }
}
